<template>
  <div>
        <basic-container>
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>数据</el-breadcrumb-item>
        <el-breadcrumb-item>充值</el-breadcrumb-item>
        <el-breadcrumb-item>每日Premium会员购买统计</el-breadcrumb-item>
      </el-breadcrumb>
    </basic-container>
    <basic-container>
      <avue-crud
        ref="crud"
        :data="data"
        v-model="form"
        :option="option"
        :page.sync="page"
        @on-load="getList"
        @refresh-change="refreshChange"
        @search-reset="from = {}"
        @search-change="searchChange"
      >
      </avue-crud>
    </basic-container>
  </div>
</template>

<script>

import { common } from "@/api/cat/httpRequest";
import { appStatisticsMemberBuyEveryday as baseUrl } from "@/api/cat/baseUrls";

export default {
  data() {
    return {
      page: {
        total: 0,
        pageSize: 10,
      },
      type: true,
      data: [],
      defalut:{
        vip_type : 3
      },
      params: {},
      form: {},
      option: {
        addBtn: false,
        editBtn: false,
        viewBtn: false,
        delBtn: false,
        excelBtn: true,
        selection: true,
border: true,
        menu:false,
        index:true,
        indexLabel: "序号",
        column: [
          {
            label: "日期",
            prop: "stats_date",
            type: "date",
          },
          {
            label: "微信充值人数",
            type: "input",
            prop: "wx_recharge_num"
          },
          {
            label: "支付宝充值人数",
            prop: "alipay_recharge_num",
            type: "input",
          },
          {
            label: "qq钱包充值人数",
            prop: "qqwallet_recharge_num",
            type: "input",
          },
            {
            label: "IOS充值人数",
            prop: "applepay_recharge_num",
            type: "input",
          },
          {
            label: "微信充值金额(元)",
            prop: "wx_recharge_money",
            type: "input",
          },
          {
            label: "支付宝充值金额(元)",
            prop: "alipay_recharge_money",
            type: "input",
          },
          {
            label: "qq钱包充值金额(元)",
            prop: "qqwallet_recharge_money",
            type: "input",
          },
          {
            label: "IOS充值金额(元)",
            prop: "applepay_recharge_money",
            type: "input",
          },
          {
            label: "月卡充值人数",
            prop: "month_card_num",
            type: "input",
          },
          {
            label: "季卡充值人数",
            prop: "season_card_num",
            type: "input",
          },
          {
            label: "年卡充值人数",
            prop: "year_card_num",
            type: "input",
          },
          {
            label: "充值总人数",
            prop: "recharge_total_num",
            type: "input",
          },
          {
            label: "充值总额(元)",
            prop: "recharge_total_money",
            type: "input",
          },
          {
            label: "选择日期",
            type: "daterange",
            prop:"daterange",
            hide: true,
            search: true,
          },
        ],
      },
    };
  },
  methods: {
             /**获取列表 */
    async getList () {
      this.loading = true;
      //清空表格列表
      this.data = [];
      this.params.orderByList = "stats_date&DESC"
      //发送请求获取数据
      let response = await common(
        `${baseUrl.pageAndParam}`,
        { ...this.params, ...this.defalut },
        this.page,
        "POST"
      );
      
      this.page = response.page;
      this.data = response.data;
      this.loading = false;
    },
    /**刷新 */
    refreshChange () {
      this.getList();
      
    },
    /**搜索 */
    searchChange (params, done) {
      params.stats_date = `${params.daterange ? "!<>!" + params.daterange : ""}`
      this.params = params;
      this.page.currentPage = 1;
      delete params.daterange
      this.getList();
      if(done){done()}
    }
  },
};
</script>